package cn.kgc.controller;

import cn.kgc.pojo.DevUser;
import cn.kgc.service.DevUserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;

@Controller
@RequestMapping("/dev")
public class DevUserController {
    @Resource
    private DevUserService devUserService;
    @RequestMapping("login")
    public String login(){
        return "devlogin";
    }
    //实现登录的功能
    @RequestMapping(value = "dologin",method = RequestMethod.POST)
    public String doLogin(@RequestParam String devCode,@RequestParam String devPassword) {
        DevUser devUser = devUserService.login(devCode, devPassword);
        if (devUser != null) {
            return "developer/index";
        }
        return "devlogin";
    }

}
